import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ReferralRecordsVO, ReferralRecordsForm, ReferralRecordsQuery } from '@/api/basicPublic/referralRecords/types';

/**
 * 查询转诊记录列表
 * @param query
 * @returns {*}
 */

export const listReferralRecords = (query?: ReferralRecordsQuery): AxiosPromise<ReferralRecordsVO[]> => {
  return request({
    url: '/basicPublic/referralRecords/list/'+query.patientId,
    method: 'get',
    params: query
  });
};

/**
 * 查询转诊记录详细
 * @param id
 */
export const getReferralRecords = (id: string | number): AxiosPromise<ReferralRecordsVO> => {
  return request({
    url: '/basicPublic/referralRecords/' + id,
    method: 'get'
  });
};

/**
 * 新增转诊记录
 * @param data
 */
export const addReferralRecords = (data: ReferralRecordsForm) => {
  return request({
    url: '/basicPublic/referralRecords',
    method: 'post',
    data: data
  });
};

/**
 * 修改转诊记录
 * @param data
 */
export const updateReferralRecords = (data: ReferralRecordsForm) => {
  return request({
    url: '/basicPublic/referralRecords',
    method: 'put',
    data: data
  });
};

/**
 * 删除转诊记录
 * @param id
 */
export const delReferralRecords = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basicPublic/referralRecords/' + id,
    method: 'delete'
  });
};

/**
 * 查询患者基本信息详细
 * @param id
 */
export const getPatientInfo = (id: any) => {
  return request({
    url: '/basicPublic/patientInfo/' + id,
    method: 'get'
  });
};
